""" 添加成员页建模 """
from selenium.webdriver.common.by import By

from .contacts_page import ContactsPage
from .base_page import BasePage

class AddMemberPage(BasePage):
    # 定位是元祖形式，定位包含两个部分，定位方式和具体元素
    _username_locator = (By.ID,"username")
    _acctid_locator = (By.ID, "memberAdd_acctid")
    _mail_locator = (By.ID, "memberAdd_biz_mail")
    _phone_locator = (By.ID, "memberAdd_phone")
    _btn_save_locator = (By.CSS_SELECTOR, ".js_btn_save")

    def add_member(self,name,account,phone):
        """ 正确填写添加成员表单信息
        1. 填写姓名
        2. 填写账号
        3. 填写邮箱
        4. 填写手机号
        5. 点击保存按钮
        """
        # self.find(self._username_locator).send_keys(name)
        # self.find(self._acctid_locator).send_keys(account)
        # self.find(self._mail_locator).send_keys(account)
        # self.find(self._phone_locator).send_keys(phone)
        # self.find(self._btn_save_locator).click()


        self.send_keys(*self._username_locator, name)
        self.send_keys(*self._acctid_locator,account)
        self.send_keys(*self._mail_locator,account)
        self.send_keys(*self._phone_locator,phone)
        self.click(*self._btn_save_locator)

        return ContactsPage(self.driver)

